import * as monaco from 'monaco-editor'

export const Themes = {}

/**
 * 主题风格类型
 */
export enum MagicThemeEnum {
  Vs = 'vs',
  VsDark = 'vs-dark'
}

/**
 * 定义主题
 */
export const defineTheme = (name, options) => {
  options = options || {}
  const editor = options.editor || {}
  editor.base = editor.base || MagicThemeEnum.Vs
  editor.inherit = editor.inherit === undefined ? true : editor.inherit
  editor.rules = editor.rules || []
  editor.colors = editor.colors || []
  monaco.editor.defineTheme(name, editor)
  Themes[name] = options.styles || {}
}
